package com.winit.pms.repository;

import com.winit.pms.model.ChangeLog;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

/**
 */
public interface PmsRepository extends PagingAndSortingRepository<ChangeLog, Long>, JpaSpecificationExecutor<ChangeLog> {
    @Query(value = " select * from pms_changelog " +
            "where DATE_FORMAT(CREATED,'%Y-%m-%d %H:%i:%s') >= ?1 " +
            "or DATE_FORMAT(UPDATED,'%Y-%m-%d %H:%i:%s') >= ?1", nativeQuery = true)
    List<ChangeLog> findByCREATEDAfterOrUPDATEDAfter(String date);
}
